Why doesn't this trigger do anything?

I am having some strange difficulties and can not figure it out. I wrote 2 scripts A and B. Script A sends emails to the user who configured a baseline whenever someone signs an electronic signature on that baseline. Script B sends emails to users configured for electronic signatures. Both of these scrips work fine on their own but only script A works in the trigger. I don't understand why B works fine in the dxl environment but not the trigger, especially since there are hardly any differences between A and B. I have attached the scripts if anybody can do me a favor and take a quick look at them. Thank you!
TheDrizzle - Thu Aug 25 13:50:51 EDT 2011

Re: Why doesn't this trigger do anything?
TheDrizzle - Thu Aug 25 14:02:20 EDT 2011

Attached the wrong thing...
Attachments

attachment_14676283_BaseLineTrigger.zip

Re: Why doesn't this trigger do anything?
Mathias Mamsch - Thu Aug 25 15:29:40 EDT 2011

TheDrizzle - Thu Aug 25 14:02:20 EDT 2011
Attached the wrong thing...

Hard to say. First of all you should check if the trigger was installed correctly and insert a print statements at the beginning of the trigger. Then you seriously need to do more error checking! The triggers will try to create attributes at the beginning of the script, without checking if the attribute is already there. You do not even check if you are in edit mode. What will happen if the user closes the module from read mode? You use "current Module" instead of "module(Trigger)" which might give you the wrong module to work with already. These could all be reasons for those scripts not running, so I truly cannot say why your trigger is failing in one case and not in the other.

Regards, Mathias

Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: Why doesn't this trigger do anything?
llandale - Thu Aug 25 17:29:01 EDT 2011

Mathias Mamsch - Thu Aug 25 15:29:40 EDT 2011
Hard to say. First of all you should check if the trigger was installed correctly and insert a print statements at the beginning of the trigger. Then you seriously need to do more error checking! The triggers will try to create attributes at the beginning of the script, without checking if the attribute is already there. You do not even check if you are in edit mode. What will happen if the user closes the module from read mode? You use "current Module" instead of "module(Trigger)" which might give you the wrong module to work with already. These could all be reasons for those scripts not running, so I truly cannot say why your trigger is failing in one case and not in the other.

Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Like that function in the middle.

... and needs to find and delete the trigger before trying to re-install it. Since the trigger is already there then installing it again does NOT udpate the DXL.

Re: Why doesn't this trigger do anything?
TheDrizzle - Fri Aug 26 08:57:16 EDT 2011

llandale - Thu Aug 25 17:29:01 EDT 2011
Like that function in the middle.

... and needs to find and delete the trigger before trying to re-install it. Since the trigger is already there then installing it again does NOT udpate the DXL.

Yeah I am pretty new at DXL so my error checking is not the best. How do I go about deleting all installed triggers? I was messing around with the triggers a lot so there are most likely multiple triggers installed that shouldn't be.

Re: Why doesn't this trigger do anything?
llandale - Sun Aug 28 17:19:21 EDT 2011

TheDrizzle - Fri Aug 26 08:57:16 EDT 2011
Yeah I am pretty new at DXL so my error checking is not the best. How do I go about deleting all installed triggers? I was messing around with the triggers a lot so there are most likely multiple triggers installed that shouldn't be.

At home with no DOORS and no code samples. A typical Trigger Deploy script can look like this:

string NameTrig = "Whatever"
string DxlCode = ""
if (The code is stored in some other file)
then DxlCode = readFile("c:/MyDoorsStuff/MyDxlCode/Trigger_Whatever.dxl")
else DxlCode = 
" code the trigger here, backslash-escaping all the double quotes and the backslashes
"   // end DxlCode
if (null DxlCode) file name wrong I guess; halt
string ErrMess = checkDxl(DxlCode)
if (!null ErrMess)
{  report DxlCode interpret errors, and ErrMess
   halt
}
Trigger trg
for trigger in Module/Project/Database do
{  if (name(trg) == NameTrg)
   {  if (confirm("Remove Trig '" NameTrig "'??"))
      then delete(trg)
      else halt        // do not attempt to install without first deleting
   }
}
if (confirm("Install Trigger '" NameTrig "'?"))
then trg = trigger(whatever)


I suppose delete trigger code for the current module could be:

 

Trigger trg
for trg in (current Module) do
{  gather info about trigger, stringOf(event(trg)) etc, and its name
   if (confirm("Delete Trigger:\n" Info)) delete(trg)
   else print NameTrit "\t" Info "\n"
}

 

 

  • Louie